<?php 
/**
 * 资源引导
 */

class Lin_Bootstrap
{
	private $bootstrap;

	public function __construct()
	{
		$this->loadBootstrap();
	}
	
	private function getFuns()
	{
		return get_class_methods(get_class($this->bootstrap));
	}
	
	private function loadBootstrap()
	{
		$this->bootstrap = new Modules_bootstrap();
	}
	
	public function boot($obj)
	{
		$funs = $this->getFuns();
		foreach ($funs as $val)
		{
			if (substr($val, 0, 2) == '__')
			{
				if ($r = $this->bootstrap->$val())
				{
					$f = substr($val, 2);
					$obj->$f = $r;
				}
			}
		}
	}
}
